package com.example.demo2.service.impl;

import com.example.demo2.entity.Amino;
import com.example.demo2.mapper.AminoMapper;
import com.example.demo2.service.AminoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author
 * @version 1.0
 * @description TODO
 * @date 2024/6/18 11:22
 */
@Service
public class AminoServiceImpl implements AminoService {
    @Autowired
    private AminoMapper aminoMapper;

    @Override
    public List<Amino> findAll(int page, int size) {
        int offset = (page - 1) * size;
        return aminoMapper.findAll(size, offset);
    }

    @Override
    public void addAmino(Amino amino) {
        aminoMapper.addAmino(amino);
    }
    @Override
    public List<Amino> searchAmino(String term) {
        return aminoMapper.searchAmino(term);
    }
    @Override
    public Amino getAminoValue(String name) {
        return aminoMapper.getAminoValue(name);
    }
    @Override
    public int count() {
        return aminoMapper.count();
    }
    @Override
    public void deleteAmino(Long id) {
        aminoMapper.deleteAmino(id);
    }
}
